const attr = {
	w: 'width',
	wx: 'max-width',
	wn: 'min-width',
	h: 'height',
	hx: 'max-height',
	hn: 'min-height',
	t: 'font-size',
	z: 'z-index',
	lh : 'line-height'
}

// let wht = /(w|h|wx|wn|hn|hx|t|z)(\d+)/g
let Re = new RegExp(`(${Object.keys(attr).join('|')})(\\d+)`,'g')
const numVal = (str)=>{
	let arrClass = str.match(Re)
	if (arrClass === null) return ''
	return arrClass.join('\n').replace(Re, ($0,$1,$2)=>{
		let unit = /(z)/.test($1) ? '' : 'px'
		return `.${$0}{${attr[$1]}:${$2}${unit};}`
	})
}

module.exports = numVal